import pickle
import threading,time,queue

# a_dict = {'da': 111, 2: [23,1,4], '23': {1:2,'d':'sad'}}
# with open('p.pickle','wb')as f:
#     # f.write()
#     pickle.dump(a_dict,f)

# with open('p.pickle', 'rb') as file:
#     a_dict1 =pickle.load(file)

# print(a_dict1)

def job(li,q):
    a=[]
    for i in li:
        a.append(i**2)
    time.sleep(1)
    # print(a)
    q.put(a)
    
def th():
    q=queue.Queue()
    th_li=[]
    data = [[1,2,3],[3,4,5],[4,4,4],[5,5,5]]
    for i in data:
        t=threading.Thread(target=job,args=(i,q))
        t.start()
        th_li.append(t)

    for t in th_li:
        t.join()

    re_li=[]
    for i in data:
        re_li.append(q.get())
    
    print(re_li)
